<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>carbon_price.as</title>
<link rel="stylesheet" type="text/css" href="../SourceStyles.css"/>
</head>

<body><pre><span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">flash</span>.<span class="ActionScriptDefault_Text">net</span>.<span class="ActionScriptDefault_Text">URLLoader</span>;

<span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">mx</span>.<span class="ActionScriptDefault_Text">collections</span>.<span class="ActionScriptDefault_Text">ArrayCollection</span>;

<span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptMetadata">Bindable</span><span class="ActionScriptBracket/Brace">]</span>
<span class="ActionScriptReserved">public</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">dataProvider</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">ArrayCollection</span><span class="ActionScriptOperator">=</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">ArrayCollection</span><span class="ActionScriptBracket/Brace">()</span>;

<span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptMetadata">Bindable</span><span class="ActionScriptBracket/Brace">]</span>
<span class="ActionScriptReserved">public</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">transportModes_dp</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">ArrayCollection</span><span class="ActionScriptOperator">=</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">ArrayCollection</span><span class="ActionScriptBracket/Brace">()</span>;



<span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptMetadata">Bindable</span><span class="ActionScriptBracket/Brace">]</span>
<span class="ActionScriptReserved">private</span> <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">styleSheet</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">StyleSheet</span>;


<span class="ActionScriptReserved">public</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">creationComplete</span><span class="ActionScriptBracket/Brace">()</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
<span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">item</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span>;
    <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">i</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Object</span> <span class="ActionScriptReserved">in</span> <span class="ActionScriptDefault_Text">data_a</span><span class="ActionScriptBracket/Brace">)</span>
    <span class="ActionScriptBracket/Brace">{</span>
        <span class="ActionScriptDefault_Text">item</span><span class="ActionScriptOperator">=</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Object</span><span class="ActionScriptBracket/Brace">()</span>;
        <span class="ActionScriptDefault_Text">item</span><span class="ActionScriptOperator">=</span><span class="ActionScriptDefault_Text">data_a</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptBracket/Brace">]</span>;
        <span class="ActionScriptDefault_Text">item</span>.<span class="ActionScriptDefault_Text">totalCost</span><span class="ActionScriptOperator">=</span><span class="ActionScriptDefault_Text">data_a</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptBracket/Brace">]</span>.<span class="ActionScriptDefault_Text">cost</span>;
        <span class="ActionScriptDefault_Text">dataProvider</span>.<span class="ActionScriptDefault_Text">addItem</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">item</span><span class="ActionScriptBracket/Brace">)</span>;
    <span class="ActionScriptBracket/Brace">}</span>
    
    <span class="ActionScriptReserved">for</span> <span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">i</span> <span class="ActionScriptReserved">in</span> <span class="ActionScriptDefault_Text">pTrans_data</span><span class="ActionScriptBracket/Brace">)</span>
    <span class="ActionScriptBracket/Brace">{</span>
        <span class="ActionScriptDefault_Text">item</span><span class="ActionScriptOperator">=</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">Object</span><span class="ActionScriptBracket/Brace">()</span>;
        <span class="ActionScriptDefault_Text">item</span><span class="ActionScriptOperator">=</span><span class="ActionScriptDefault_Text">pTrans_data</span><span class="ActionScriptBracket/Brace">[</span><span class="ActionScriptDefault_Text">i</span><span class="ActionScriptBracket/Brace">]</span>;
        <span class="ActionScriptDefault_Text">item</span>.<span class="ActionScriptDefault_Text">incrementalCost</span><span class="ActionScriptOperator">=</span>0;
        <span class="ActionScriptDefault_Text">transportModes_dp</span>.<span class="ActionScriptDefault_Text">addItem</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">item</span><span class="ActionScriptBracket/Brace">)</span>;        
    <span class="ActionScriptBracket/Brace">}</span>

    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">urlLoader</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">URLLoader</span><span class="ActionScriptOperator">=</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">URLLoader</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">urlLoader</span>.<span class="ActionScriptDefault_Text">addEventListener</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">Event</span>.<span class="ActionScriptDefault_Text">COMPLETE</span>, <span class="ActionScriptDefault_Text">urlLoader_complete</span><span class="ActionScriptBracket/Brace">)</span>;
    <span class="ActionScriptDefault_Text">urlLoader</span>.<span class="ActionScriptDefault_Text">load</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">URLRequest</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptString">&quot;org/quantitativesustainability/styles/default.css&quot;</span><span class="ActionScriptBracket/Brace">))</span>;
    
    <span class="ActionScriptDefault_Text">qsChart</span>.<span class="ActionScriptDefault_Text">init</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">dataProvider</span><span class="ActionScriptBracket/Brace">)</span>; 
    <span class="ActionScriptDefault_Text">pTrans_chart</span>.<span class="ActionScriptDefault_Text">init</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">transportModes_dp</span><span class="ActionScriptBracket/Brace">)</span>;
    
    <span class="ActionScriptDefault_Text">activeChart</span><span class="ActionScriptOperator">=</span><span class="ActionScriptDefault_Text">charts_tn</span>.<span class="ActionScriptDefault_Text">selectedChild</span>.<span class="ActionScriptDefault_Text">getChildren</span><span class="ActionScriptBracket/Brace">()[</span>0<span class="ActionScriptBracket/Brace">]</span>;
    
    <span class="ActionScriptDefault_Text">info</span>.<span class="ActionScriptDefault_Text">acc</span>.<span class="ActionScriptDefault_Text">selectedChild</span><span class="ActionScriptOperator">=</span><span class="ActionScriptDefault_Text">info</span>.<span class="ActionScriptDefault_Text">discussion</span>;
<span class="ActionScriptBracket/Brace">}</span><span class="ActionScriptComment">//init();
</span>
<span class="ActionScriptReserved">private</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">urlLoader_complete</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">evt</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">Event</span><span class="ActionScriptBracket/Brace">)</span><span class="ActionScriptOperator">:</span><span class="ActionScriptReserved">void</span>
<span class="ActionScriptBracket/Brace">{</span>
    <span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">css</span><span class="ActionScriptOperator">:</span><span class="ActionScriptDefault_Text">String</span><span class="ActionScriptOperator">=</span><span class="ActionScriptDefault_Text">URLLoader</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">evt</span>.<span class="ActionScriptDefault_Text">currentTarget</span><span class="ActionScriptBracket/Brace">)</span>.<span class="ActionScriptDefault_Text">data</span>;
    <span class="ActionScriptDefault_Text">styleSheet</span><span class="ActionScriptOperator">=</span><span class="ActionScriptReserved">new</span> <span class="ActionScriptDefault_Text">StyleSheet</span><span class="ActionScriptBracket/Brace">()</span>;
    <span class="ActionScriptDefault_Text">styleSheet</span>.<span class="ActionScriptDefault_Text">parseCSS</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">css</span><span class="ActionScriptBracket/Brace">)</span>;
<span class="ActionScriptBracket/Brace">}</span>

</pre></body>
</html>
